import { ElMessage } from 'element-plus'
export const exportExcel = function (data, title) {
  var blob = new Blob([data])
  blob.text().then((data) => {
    try {
      const parseData = JSON.parse(data)
      ElMessage.error(parseData.errMessage)
    } catch (error) {
      var downloadUrl = window.URL.createObjectURL(blob)
      var anchor = document.createElement('a')
      anchor.href = downloadUrl
      anchor.setAttribute('download', `${title}.xls`)
      document.body.appendChild(anchor)
      anchor.click()
      document.body.removeChild(anchor)
    }
  })
}
